An efficient constructive heuristic for the rectangular packing problem with rotations

The rectangular packing problem has been extensively studied over the years due to its wide application in industry. However, most of the research efforts are devoted to positioning techniques of the rectangles for various problem variants, the efficient implementation of the packing procedure is relatively less studied. In this paper, we propose an efficient constructive algorithm for the rectangular packing problem with rotations. We design a preprocess procedure with four data structures to store the information used for item selection. The gaps on the skyline are categorized into three types according to their associated edges for the placement procedure, during which the item is searched and packed in a descending order of the fitness value. The entire constructive phase takes a time complexity of O(nlogn). For the packing improvement phase, we optimize the packing through random perturbation on the sequence and orientation of the item. Three classes of stochastic problems are generated ranging from small-scale to extra-large-scale, the recorded running time confirms the efficiency of the proposed algorithm. We also test the proposed algorithm on the benchmark problem C21, N13, NT, Babu and CX, the computational results show that it delivers a good performance.


Introduction
Given a group of large objects with regular shape and homogeneous material, designing an assortment of the small items accommodated by the large objects to minimize the waste is the classic cutting and packing problem [1].Additional constraints in industrial applications may add properties to the cutting and packing problem, which defines a wide range of problem variants.For example, the small items can be rectangles, circles, polygons or even contour shapes with curved edges, and the large objects may have concave areas or defective parts that cannot be used for placement [2].
Usually, the computational time allowed for any specific problem depends on the material utilization and the task urgency, thus, most of the solutions attempt to make a trade-off between solution quality and the time consumption [3].From a mathematical point of view, cutting and packing are closely related as they indicate the same computing process, they also share the same target that the predefined objective should be achieved with the fewest possible resources or the limited resources should be used to generate the best possible results [4].
The rectangular packing problem is categorized as a sub-type of the cutting and packing problem, where the items are rectangles and should be placed exactly into the container without overlap [5].There are two most documented variants of the rectangular packing problem, the multiple bin packing problem and the strip packing problem.The former arranges a group of identical-sized or variable-sized bins and the items are supposed to fill the bins as much as possible [6][7][8], the later defines a container holding an open dimension which needs to be minimized through elaborate placement of all the given items [9][10][11].
Since real application may focus on more complicated scenarios in the field of production planning, scheduling, routing and loading, multi-objective optimization in combination with packing has attracted an increasing amount of attention as well.Wu studied a variant in which the ratio of the two dimensions of the rectangular layout should be kept within given range and predefined central rectangle should be placed near the center of the layout [12].Ferna ´ndez analyzed the approach to extend memetic algorithms to solve a the two-dimensional bin packing problem with requirements on loading balance [13].Queiroz dealt with the two dimensional strip packing problem where the gravity center of the item must lie in a safety region and the given maximum tolerable weight which the item could bear must be satisfied [14].Gajda studied a container loading problem handling a group of constraints simultaneously, including loading priorities, load bearing and balancing, unloading order, weight limits, cargo stability and positioning constraints [15].
A few exact methods have been proposed to solve the rectangular packing problem in recent years, the algorithms are mainly based on integer programming [16,17] and dynamic programming [18].While the exact methods are often used to solve problems of small-scale, most of the literature adopts the heuristic approaches.Burke [3] proposed a best fit (BF) strategy, the algorithm examines the lowest available space and always places the rectangle which matches the space.BF is reported to have made significant progress in terms of packing quality as well as computational efficiency, it is further studied over the years in the placement techniques [19,20] or the improvement methods [21,22].
Another recent attempt to solve the packing problem is to automate the design of heuristics, since the problem specific methods may have insufficient generality for other problems within a domain [23].Lo ´pez-Camacho et al. developed a selection hyper-heuristic approach which constructs the solution incrementally, and each step contains a forward check to ensure the solution quality.Their model automatically selects the best heuristic for a given instance and the results are comparable to single heuristic [24].
As BF executes with the dynamic selection of the item during each placement, trivial implementation naturally takes a time complexity of O(n 2 ).Although many heuristics with the BF architecture have been adopted to solve the packing problems, there are considerably few studies researching the efficient implementation of the packing procedure.The first research considering the efficient implementation of the BF heuristic is reported by Imahori & Yagiura, they stored the skyline with a heap and a doubly linked list, then, they used the balanced binary search tree to search for the fittest rectangle [25].Wei et al. proposed a scoring rule based BF heuristic for the fixed orientation variant of the strip packing problem, where the scoring rule evaluates the matching edges between the item and the skyline, and they used a segment tree to search for the item in particular placement [26].
Inspired by Wei's study [26], this paper presents an efficient constructive heuristic for the rectangular strip packing problem, in which the rectangles are allowed with the rotation of 90˚.The constructive phase of the packing is initialized with a preprocess in which four data structures are designed to store the necessary information required by item selection.Then, the placement of item is implemented piece by piece, and the four data structures are updated continuously with the item selection.An optimization algorithm with random perturbation is provided for the packing improvement.The main contributions of this paper are: (i) an efficient implementation method of the rectangular constructive phase; (ii) an optimization algorithm to improve the packing quality; (iii) comparison between the efficient implementation and the original implementation on a group of packing problems from small-scale to extralarge-scale; and (iv) performance evaluation on a set of benchmark problems, which demonstrates that the proposed method provides satisfactory packing results.
The rest of the paper is organized as follows.In section 2, we provide the preliminaries of the study, including the best fit heuristic architecture and the segment tree used for item searching.In section 3, we propose the efficient rectangular packing heuristic for the constructive phase and design an optimization algorithm for the improvement phase.We present the computational experiments in section 4 and summarize the conclusions in section 5.

Rectangular selection strategy
The problem solved in this paper is defined in the same way as [27], i.e., a container with a fixed width denoted by W and an open dimension is provided to accommodate the rectangles.Let the number of the rectangles to be packed be n, we denote the length of each rectangle by l i , width by w i , i2 [1, n].The packing length is denoted by L'.The rectangles are allowed of the rotation of 90˚.
We follow the architecture of the BF heuristic [3] and use the fitness evaluation rule [26] for the item selection.We always choose the bottom left skyline as the placement position.Then, the associated gap on the boundary [27] determines the shape of the next item to be placed.The fitness evaluation rule is used to select the most suitable rectangle.The fitness value is computed as the number of identical dimensions between the item and the gap, if there is an edge of the item which aligns with that of the gap, the fitness value is increased by 1.Then, the fitness value of the placement could 3, 2, 1 or 0.
If there is a tie, the earliest item in the sequence which has not been placed will be chosen.Then, under specific settings, the item selection is transferred to the range minimum query problem, where the item holding the minimal index is supposed to be picked out.The Segment tree [28,29] is used to solve the range minimum query problem.Suppose the given range contains n' elements.The segment tree is constructed through the decomposition of the large range into small units.Then, the node is iteratively assigned with the minimum value of the split range, from the leaf to the parent.The construction of the segment tree takes a time complexity of O(n'logn'), and both the query of a particular range and the update of single element take O(logn').

Efficient rectangular packing heuristic
In this section, we present the efficient heuristic for the rectangular strip packing problem.We propose the efficient implementation of the constructive phase in section 3.1 and design a optimization algorithm for the improvement phase in section 3.2.

Packing constructive algorithm
The constructive phase is composed of the preprocess procedure and the placement procedure.The preprocess procedure defines the necessary data structures used throughout the packing, and the placement procedure implements the placement of the n items piece by piece.
We denote the top edge of the bottom left gap by e t , the side edge which represents the width of the gap by e w , and the bottom edge by e b .as shown in Fig 1, the gap is marked with highlight.In this section, the fitness value of the placement is defined as the number of alignments between the item and the three edges of the gap.
3.1.1Preprocess.We design four data structures to search for the particular items, which are denoted by D 1 , D 2 , D 3 and D 4 , respectively.We list the type of basic data structure contained in D 1 -D 4 and the target placement of each data structure in Table 1.
In the data structure D 1 , we use a hash table and a group of lists to store the items.The key represents the size of each type of rectangle, it is recorded by (l i , w i ), i.e., a tuple of the length and width of the rectangle, and the value is represented by a list to store the given sized item.D 1 is built by traversing the items.When a new size type of the item is met, a new key will be added to the hash table, and a list is initialized with the item specified as the first element.If an item with the size already stored in the hash table, the relevant list will be found through the key, then, the item will be appended to the list.An example is provided for the construction of the four data structures.Suppose there are nine items to be packed, we denote them by r 1 -r 9 and their sizes are (2, 3), (4, 5), (3,2), (6,8), (4,5), (6,10), (6,3), (6,5) and (6,7).The first item with size (2, 3) will add a key of (2, 3) to D 1 , and it becomes the first element in the relevant list, then, D 1 = {key: (2, 3), value: [r 1 ]}.The second item will update D 1 in the same way, so will the third item and the fourth item.After the update by the fourth item, D 1 = {key: (2, 3), value: [r 1 ]; key: (4, 5), value: [r 2 ]; key: (3, 2), value: [r 3 ]; key: (6, 8), value: [r 4 ]}.When it comes to the fifth item, there already exists the key (4, 5), so no key will be added to D 1 , and the fifth item will be appended to the list with key ( 4 In the data structure D 2 , another hash table is used to store the items.Unlike D 1 , the key represents the type of the single dimension of the rectangle, which is recorded with either l i or w i , and the value is represented by a list to store the item holding the given dimension.We continue with the example of the nine items presented above.The first item has the dimension of 2 and 3, then, a key of 2 and another key of 3 will be added to D 2 , and the first item becomes the first element both in the relevant list of key 2 and the relevant list of key 3, i.The data structure D 3 is generated from D 2 .We make a copy of D 2 , then, we sort the items in the list of each key by the other dimension of the item in the descending order.Then, a segment tree is built according to the sorted sequence.The hash table, sorted sequence and the segment tree comprise D 3 .The node of the segment tree represents the item with the minimum index in the given range.For example, the list of key 6 has five items namely r 4 , r 6 , r 7 , r 8 and r 9 , and the other dimensions of them are 8, 10, 3, 5, 7, respectively.Then, the list would be [r 6 , r 4 , r 9 , r 8 , r 7 ] after sorting.The segment tree is built as shown in Fig 2 .For the data structure D 4 , we sort the items by the minimal size of their two dimensions in the descending order.Another segment tree is built based on the sorted sequence, with the node still representing the item with the minimum index in the given range.For example, the minimal sizes of the nine items r 1 -r 9 are 2, 4, 2, 6, 4, 6, 3, 5, 6, respectively, then, the list after sorting would be [r 4 , r 6 , r 9 , r 8 , r 2 , r 5 , r 7 , r 1 , r 3 ].The segment tree is built in the same way as that in D 3 , with the associated range containing all the 9 items.
We sort the items with merge sort in D 3 and D 4 , during which we record the position of each item in the sorted sequence.
Since the skyline is continually updated with each placement, if a skyline does not have enough space for further placement, the skyline will be removed and merged into the neighbor skylines.The space for further placement is judged by the size of the skyline and the minimum dimension of the rest items.Hence, we have to continually track the smallest sized item in order to check if it has been placed or not.We denote the minimum dimension of the rest items by lw min .We use another hash table denoted by H lwmin to store all the items, and we make a copy of the sorted sequence in D 4 .Then, we design a pointer denoted by P lwmin to locate the last item in the sequence, and lw min is initialized with the minor value of the two dimensions of the item pointed by P lwmin .
As presented in Table 1, among the four data structures D 1 -D 4 , D 1 is used to search for the full matching placement, i.e., the item which could produce a fitness value of 3 or 2. If none of the remained items satisfy the placement with the fitness value of 3 or 2, D 2 and D 3 will be used to search for the item which has one dimension alignment with the gap.If none the remained items could not create the placement with non-zero fitness value, D 4 will be used to search for the item which could be accommodated by the gap.The details of the item selection will be described in section 3.2.
The data structure D 1 is built with the traversal of the items, both the addition of new key and the search for the existing key take the constant time, so does the element addition in the relevant list.Then, the construction of D 1 takes O(n).The construction of D 2 is similar to D 1 and has the time complexity O(n).The merge sort takes O(nlogn), and the construction of the segment tree takes O(nlogn), then, the constructions of D 3 and D 4 take O(nlogn).Hence, the time complexity of the preprocess is O(nlogn).

Efficient implementation of rectangular constructive algorithm.
According to the position of the gap, we divide the placements of the rectangles into three types, as illustrated in Fig 3 .In the first type, the gap is positioned inside the container, and its top edge and bottom edge have the same size, i.e., e t = e b .The placement could have a maximum fitness value of 3 if the item has the full matching with the gap, as shown in Fig 3(A).Otherwise, the fitness value would be 1 if the item only aligns with one edge of the gap.If the item has a completely different shape compared with the gap that none of its edges could align with the gap, then, the fitness value is 0.
In the second type, the gap is also positioned inside the container, with its top edge and bottom edge shaped with different size, i.e., e t 6 ¼ e b .The maximum fitness value of the placement The third type is relatively special which represents the case that none of the items have been packed, or the case that the packed items exactly share the same boundary.In this type, the skyline fills the fixed dimension of the container, and both e t and e b could extend without limitation.The fitness value could be 1 only if one dimension of the item is equal to the width of the container.
Note that the case in which the gap is positioned on the top of the container (as shown in Fig 4(A)) or the case in which the gap is positioned on the bottom of container (as shown in Fig 4(B)) could be categorized into the first type.
Whether an item could be placed at the gap is decided by the width of the gap.If one of the item dimensions is smaller than e w , then, the item could be placed at the gap, either with a rotation of 0˚or 90˚.
We initialize the packing length L' with 0. As there might be more than one item that could produce the placement with non-zero fitness value, we use three lists to store the item in the placement with the fitness value of 3, 2, 1, and they are denoted by L f = 3 , L f = 2 , L f = 1 , respectively.The efficient constructive algorithm is presented in algorithm.
Each placement starts from the gap shaped by the bottom left skyline (line 3, 4), and the placements under the gap type 1 (line 5-15), the gap type 2 (line 16-26) and the gap type 3 (line 27-33) are addressed individually.
If the gap belongs to the type 1, the item with fitness value 3 will be searched first.The item should be shaped with both the dimension of e b and e w .We search for the key of (e b , e w ) in D 1 , if the key exists, enter the relevant list of item, and we select the first item without mark (i.e., it has not been packed) and store the item in L f = 3 .We also search for the key of (e w , e b ) in D 1 , which represents the placement of the item with size (e w , e b ) under a rotation of 90˚, and we store the item in L f = 3 (line 7).If L f = 3 6 ¼ Ø, we choose the item with the minor index in L f = 3 as the one to be packed (line 9).Otherwise, there does not exist the placement of fitness value 3, we continue with the search for the placement of fitness value 1.
Algorithm 1. Packing constructive algorithm 1. Initialize L' and the skyline 2. for i = 1 to n do: 3. Choose the bottom left skyline 4. Compute e t , e w , e b of the gap 5. if the gap belongs to type 1: 6.
Reset the list Search for item with fitness value 3 and store the result in choose the item with minor index in L f = 3 .10.
Search for item with fitness value 1 and store the result in choose the item with minor index in L f = 1 .14.
Search for item with fitness value 0 and choose the item 16. if the gap belongs to type 2: 17.
Search for item with fitness value 2 and store the result in choose the item with minor index in L f = 2 .21.
Search for item with fitness value 1 and store the result in choose the item with minor index in L f = 1 .25.
Search for item with fitness value 0 and choose the item 27. if the gap belongs to type 3: 28.
Reset the list L f = 1 29.
Search for item with fitness value 1 and store the result in L f = 1 30. if choose the item with minor index in L f = 1 .32.
Search for item with fitness value 0 and choose the item 34.Update data structure D 1 -D 4 35.Compute the packing length L' 36.Relocate the pointer P lwmin and reset the minimum dimension lw min 37. Update the skyline 38.return L' For the placement of fitness value 1, we search for the key e w in D 2 and store the item in L f = 1 , which represents the alignment between e w of the gap and the item.We also search for the key e b in D 3 , which represents the alignment between e b of the gap and the item.In the relevant list of key e b , the item has to satisfy an additional requirement that the dimension other than e b should be smaller than e w .We use the binary search to find the position of the first item which has the dimension smaller than e w , we denote the position by p D3 , then, the items in the range from p D3 to the end of the list could meet the dimension requirement.The segment tree in D 3 (presented in section 3.1.1)is used to find the item with the minimum index in the given range, and the item will also be stored in L f = 1 (line 11).To continue with the example presented in section 3.1.1,we suppose that e b = 6 and e w = 9.Then, the search for the key e b in D 3 results in the list [r 6 , r 4 , r 9 , r 8 , r 7 ], and the additional requirement on the other dimension limits the available item within the range [r 4 , r 9 , r 8 , r 7 ].In this case, the item r 4 is selected since it has the minimum index, and it is stored in L f = 1 .If L f = 1 6 ¼ Ø, we choose the item with the minor index in L f = 1 as the one to be packed (line 13).Otherwise, there does not exist the placement of fitness value 1, we search for the placement of fitness value 0 (i.e., the item with the minimal index which could be placed at the gap).
For the placement of fitness value 0, we use the binary search to find the position of the first item which has the dimension smaller than e w in the list of D 4 , we denote the position by p D4 , then, the items in the range from p D4 to the end of the list could be placed at the gap.The segment tree in D 4 is used to find the item with the minimal index in the given range (line 15).
If the gap belongs to the type 2 or the type 3, the operation is similar to that of type 1, with priority given to the placement of the larger fitness value.
After the item selection, the placement orientation of the item is determined by the match between its dimension and the shape of the gap.Besides, each placement of the chosen item will update the four data structures.
For the update of D 1 , group the length l i and the width w i of the selected item as the key (l i , w i ) and search the key in D 1 , then the relevant list could be returned.As each item is appended to the end of the list in the preprocess, the items are naturally sorted in an increasing order of the index.We use binary search to search for the index of the item and we get the position, then, we mark this position as the item has been placed.
The update of D 2 is similar to D 1 , we use both the length l i and the width w i of the selected item as the key and get the relevant list individually.Then, we use the binary search to find the item and mark the item as used.
For the update of D 3 , as the hash table in D 3 has the same key as that in D 2 , we already get the position of the chosen item in the relevant list in D 2 , and we have recorded the position of each element of the list in the sorted sequence (mentioned in section 3.1.1),then, the position of the chosen item in the relevant list in D 3 could be computed.The leaf node will be tracked recursively along the direction from the root to the associated child, and its value is replaced with n+1, then, the item will not be selected in later steps in the range query on the tree.For example, when the item r 4 is selected, it can be computed that r 4 lies in the second position of the relevant list, with which the leaf node in the segment tree is tracked and found, as shown in Fig 5(A).Then, all the nodes along the track are updated, the minimal value of each node and its sibling node will replace that of the parent node, as shown in Fig 5(B).The update of D 4 is similar to D 3 , we replace the associated node in the segment tree with value of n+1.
We also update the minimum dimension of the rest items.Each selected item will be removed from the hash table H lwmin .Then, if the item being located by the pointer P lwmin is still in H lwmin , it means the item with the minimum dimension has not been placed, thus, the minimum size lw min will remain unchanged.If the item being located by P lwmin is not in H lwmin , P lwmin will move towards the beginning of the sequence one by one, until it reaches the item that is still in H lwmin .Then, lw min will be replaced by the minimum dimension of the pointed item.
The placement procedure is composed of three major steps, namely the selection of the fittest item, the update of the data structures, and the update of the minimum size lw min of the item.The search through hash table takes constant time, while the query on the segment tree takes O(logn), then, the selection of the fittest item takes O(logn).The update of the four data structures also takes O(logn) due to the update of the node in the segment tree.Thus, these two steps in the traversal take O(nlogn).For the update of lw min , as the pointer P lwmin purely moves towards the beginning of the sorted sequence throughout the packing of the n items, it takes O(n).Hence, the placement procedure takes O(nlogn), and the time complexity of the entire constructive phase is O(nlogn).
The procedure of the constructive phase is illustrated in Fig 6, the preprocess procedure (presented in section 3.1.1)and the placement procedure (presented in this section) are marked separately.The four data structures D 1 -D 4 and the pointer P lwmin are initialized in the preprocess procedure.Then, each placement starts from the bottom left skyline and the type of the gap is decided.The item is selected according to the fitness value from largest to smallest, and D 1 -D 4 as well as P lwmin are updated.

Packing optimization algorithm
We design the optimization algorithm for the improvement phase.Since the rectangles are allowed with the rotation of 90˚, the solution is composed of the sequence and the orientation of the n items.We adopt the idea proposed by Wei et al. [26] and adapt it to the optimization on both the sequence and the orientation.
We denote the sequence and orientation of the n items by S and O respectively.The sequence, orientation and the packing length of the best solution are denoted by S opt , O opt and L' opt respectively.
A group of solutions is used to explore the neighborhood of the optimal solution.We denote the number of the solutions by N g , the sequence of the i-th solution by S i and the orientation the i-th solution by O i , i2[1, N g ].The packing optimization algorithm is presented in algorithm 2. Algorithm 1 is invoked to pack the items under the given sequence and the given orientation, with the packing length L' of the i-th solution returned (line 4, 9).The group of solutions are initialized in line 2-4, the sequence S i is initialized in the descending order of the perimeter of the item, and the orientation O i is initialized with random rotation of 0˚or 90˚(line 3).Then, the solution with the minimal packing length is selected as the optimal solution (line 5).
The group of solutions is updated continually in the iterations (line 6-10).Each solution is updated through an operator of random swap implemented on the optimal sequence S opt or an operator of random orientation change on the optimal orientation O opt (line 8).The optimal solution will be replaced with new solution which produces the smaller packing length (line 10).

Experiments and discussion
In this section, we generate a group of stochastic problems to testify the running time of the proposed algorithm.Then, we test the proposed algorithm on a set of benchmark problems.The algorithm is coded in python and tested under the computational environment of 2.3GHz CPU and 16 GB RAM without multithreading.
We design the stochastic problems in which the number of item is set with 10 t , where t2 [1,6], representing the packing problems from small-scale to extra-large-scale.We denote these six stochastic problems by P1-P6, respectively.Three classes of value ranges are set on the item dimension, namely [10,100], [10,500] and [10,1000], and we denote them by class1, class2 and class3 respectively.Both the dimensions of each item are randomly selected integers within the given range.
We list the time consumption of both the original implementation (time complexity O(n 2 )) and the proposed efficient implementation (time complexity O(nlogn)) of constructive phase in Table 2.For the original implementation, "-" means that the running time exceeds 10 minutes and it cannot be recorded.The time consumption for the efficient implementation is presented in Fig 7 .The x-axis values denote the scale of the problem, and the y-axis values denote the running time (s), The results from Table 2 and Fig 7 show that the proposed rectangular constructive algorithm is executed considerably fast.The efficient implementation takes almost the same amount of time compared with the original implementation on small-scale problems (n � 10 2 ), while it presents clear advantages over the original implementation on the problems with n � 10 4 .The implementation of packing 10 4 items would only takes about 1s, even for the extra-large-scale problem, the running time could be reduced to nearly 100s, which cannot be completed by the original implementation.We note that the ordinary behavior of the efficient implementation compared with the original implementation on small-scale problems could be explained by the preprocess procedure, since a certain amount of computational effort is allocated to the initialization of the designed data structures.
To test the performance concerning the packing qualities, we evaluate the proposed algorithm on the benchmark problem C21 [30], N13 [3], NT [31], Babu [32] and CX [33], same as the research in [34] has presented.For simplicity, we name the efficient constructive heuristic proposed in this paper (along with the packing optimization algorithm) as EH.The running time od EH is limited within 60s, and the optimization algorithm will be stopped when the packing length reaches LB.EH is run 10 times on each of these problems and the best result is recorded.The results are presented in Tables 3-6.The lower bound (optimal packing length) is denoted by LB, and the gap represents the result of 100 * (L'-LB) / LB.Some excellent algorithms are listed here for comparison, they include FH (Leung et al., 2011, [35]), BBF (Aşık et al., 2009, [20]), BBFM (O ¨zcan et al., 2013, [36]), IDBS (Wei et al., 2011, [19]), BFHA (Chen et al., 2019, [34]).To the best of our knowledge, IDBS performs rather effectively and it holds by far the best record on the rectangular strip packing problem with rotations.The optimal results (equal to LB) found by the above algorithms are presented in bold.The computational results testify that EH behaves effectively on the benchmark problems, especially EH could find the optimal solutions on all the problems of N13 within 60s.On C21, EH appears slightly inferior to BFHA, but EH still provides 19 optimal results out of the 21 problems, while BFHA takes a large amount of computational effort on a few particular problems.
The problem NT has been relatively difficult to solve in the literature through heuristic approaches.IDBS shows rather excellent performance that it provides the minimum gap from minimum dimension item for the update of skyline.Through the designed data structures, the entire time complexity of the constructive phase is O(nlogn).An optimization algorithm is presented for the improvement phase, where the packing is optimized through random swap on the sequence or the random change on the orientation of the item.We design three classes of stochastic problems with the number of items ranging from 10 1 to 10 6 , the running time indicates the efficiency of the proposed algorithm.The proposed algorithm is also tested on the benchmark problem C21, N13, NT, Babu and CX, the results show that it provides satisfactory packing qualities.